import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询客户分销列表
export function listUser(data) {
  return request({
    url: '/customer/distribution/customerDistributionList',
    method: 'post',
    data: data
  })
}

// 查询客户分销详细
export function getUser(userId) {
  return request({
    url: '/customer/distribution/' + parseStrEmpty(userId),
    method: 'get'
  })
}

// 新增客户分销
export function addUser(data) {
  return request({
    url: '/customer/distribution/customerDistributionInsert',
    method: 'post',
    data: data
  })
}

// 修改客户分销
export function updateUser(data) {
  return request({
    url: '/customer/distribution/customerDistributionUpdate',
    method: 'post',
    data: data
  })
}

// 客户状态修改
export function changeUserActive(userId, active) {
  const data = {
    userId,
    active
  }
  return request({
    url: '/customer/distribution/customerDistributionChangeActive',
    method: 'put',
    data: data
  })
}